﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ModelBindingDemo.Models;

namespace ModelBindingDemo.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            Employee emp = new Employee();
            return View(emp);
        }

        [HttpPost]
        public ActionResult Edit0()
        {
            string id = Request.Form["ID"];
            string fname = Request.Form["FirstName"];
            string lname = Request.Form["LastName"];
            ViewBag.StatusMessage = "Emp data received for id: " + id;
            return View("Index", new Employee());
        }

        [HttpPost]
        public ActionResult Edit1(string id, string firstname, string lastname)
        {
            ViewBag.StatusMessage = "Emp data received for id: " + id + "; " + firstname + "; " + lastname;
            return View("Index", new Employee());
        }
        [HttpPost]
        public ActionResult Edit2(Employee emp)
        {

            ViewBag.StatusMessage = "Emp data received for id: " + emp.ID + "; " + emp.FirstName+  "; " + emp.LastName;
            return View("Index", new Employee());
        }

    }
}
